<!DOCTYPE html>
<html>
<head>
    <title>贷款产品表</title>
    #parse("sys/header.html")

    <style>
        input#import-file-btn {
            width: 100px;
            height: 30px;
            margin-top: 1%;
            border-radius: 3px;
        }
    </style>
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <Row :gutter="16">
            <div class="search-group">
                <i-col span="4">
                    <i-input v-model="q.title" @on-enter="query" placeholder="名称"/>
                </i-col>
                <i-button @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
            <div class="buttons-group">
                #if($shiro.hasPermission("product:save"))
                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
                #end

                #if($shiro.hasPermission("product:importData"))
                <i-button type="info" @click="importData"><i class="fa fa-plus"></i>&nbsp;上传数据</i-button>
                #end
                #if($shiro.hasPermission("product:update"))
                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
                #end
                #if($shiro.hasPermission("product:delete"))
                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                #end
            </div>
        </Row>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <Card v-show="!showList">
        <p slot="title">{{title}}</p>
        <i-form ref="formValidate" :model="product" :rules="ruleValidate" :label-width="150">
            <row :gutter="24">
                <i-col span="6">
                    <Form-item label="产品名称" prop="title">
                        <i-input v-model="product.title" placeholder="请输入产品名称"/>
                    </Form-item>
                </i-col>
                <i-col span="6">
                    <Form-item label="贷款银行" prop="loanBankId">
                        <i-select v-model="product.loanBankId" placeholder="请选择银行">
                            <i-option v-for="each in options.loanBankList" :value="each.value" :key="each.value">
                                {{
                                each.label
                                }}
                            </i-option>
                        </i-select>
                </i-col>
                <i-col span="6">
                    <Form-item label="贷款年限" prop="years">
                        <i-input v-model="product.years" placeholder="请输入贷款年限">
                            <span slot="append">年</span>
                        </i-input>
                    </Form-item>
                </i-col>
            </row>
            <row :gutter="24">
                <i-col span="6">
                    <Form-item label="最大贷款额度" prop="maxQuota">
                        <i-input v-model="product.maxQuota" placeholder="请输入最大贷款额度">
                            <span slot="append">万元</span>
                        </i-input>
                    </Form-item>
                </i-col>
                <i-col span="6">
                    <Form-item label="贷款利率" prop="loanRate">
                        <i-input v-model="product.loanRate" placeholder="贷款利率">
                            <span slot="append">%</span>
                        </i-input>
                    </Form-item>
                </i-col>
                <i-col span="6">
                    <Form-item label="税务等级" prop="taxLevel">
                        <checkbox-group v-model="chosenTaxArr" @on-change="updateTaxLevel()">
                            <checkbox v-for="level in options.taxLevelList" :label="level.value">
                                <span>{{level.label}}</span>
                            </checkbox>
                        </checkbox-group>
                    </Form-item>
                </i-col>
            </row>
            <row :gutter="24">
                <i-col span="18">
                    <Form-item label="产品内容" prop="details">
                        <div id="introduce"></div>
                        <!--                <i-input v-model="product.details" placeholder="请输入产品内容"/>-->
                    </Form-item>
                </i-col>
            </row>
            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px"/>
                返回</i-button>
                <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
            </Form-item>
        </i-form>
    </Card>

    <div>
        <modal v-model="show.importData" title="上传文件" width="80%">
            <Row :gutter="16">
                下载模板:
                <i-button type="info" @click="downloadExcel"><i class="fa fa-plus"></i>&nbsp;下载模板</i-button>
            </Row>
            <Row :gutter="16">
                <form id="upload-form" enctype="multipart/form-data">
                    <p>上传文件： <input type="file" name="file"/></p>
                    <input type="button" id="import-file-btn"  @click="makeItHappen" value="上传"/>
                </form>
            </Row>
        </modal>
    </div>

</div>

<script src="${rc.contextPath}/js/lht/product.js?r=_${date.systemTime}"></script>
</body>
</html>